`define ResetEnable         1'b1
`define ResetDisable        1'b0
`define ZeroWord            32'h00000000
`define WriteEnable         1'b1
`define WriteDisable        1'b0
`define ReadEnable          1'b1
`define ReadDisable         1'b0
`define ALUOpBus            7:0
`define ALUSelBus           2:0
`define InstructionValid    1'b1
`define InstructionInvalid  1'b0
`define TrueValue           1'b1
`define FalseValue          1'b0
`define ChipEnable          1'b1
`define ChipDisable         1'b0

`define EXE_ORI             6'b001101
`define EXE_SPE             6'b000000 
`define EXE_ANDI            6'b001100
`define EXE_XORI            6'b001110
`define EXE_LUI             6'b001111

`define EXE_ADDI            6'b001000
`define EXE_ADDIU           6'b001001
`define EXE_SLTI            6'b001010
`define EXE_SLTIU           6'b001011

`define EXE_SLL             6'b000000
`define EXE_SRL             6'b000010
`define EXE_SRA             6'b000011
`define EXE_J               6'b000010
`define EXE_JAL             6'b000011
`define EXE_BEQ             6'b000100
`define EXE_BGTZ            6'b000111
`define EXE_BLEZ            6'b000110
`define EXE_BNE             6'b000101
`define EXE_REGIMM          6'b000001

`define FUC_BLTZ            5'b00000
`define FUC_BLTZAL           5'b10000
`define FUC_BGEZ            5'b00001
`define FUC_BGEZAL          5'b10001

`define FUC_AND             6'b100100
`define FUC_OR              6'b100101
`define FUC_XOR             6'b100110
`define FUC_NOR             6'b100111
`define FUC_SLLV            6'b000100
`define FUC_SRLV            6'b000110
`define FUC_SRAV            6'b000111
`define FUC_SYNC            6'b001111

`define FUC_MOVZ            6'b001010
`define FUC_MOVN            6'b001011
`define FUC_MFHI            6'b010000
`define FUC_MFLO            6'b010010
`define FUC_MTHI            6'b010001
`define FUC_MTLO            6'b010011
`define FUC_ADD             6'b100000
`define FUC_ADDU            6'b100001
`define FUC_SUB             6'b100010
`define FUC_SUBU            6'b100011
`define FUC_SLT             6'b101010
`define FUC_SLTU            6'b101011
`define FUNC_MULTU          6'b011001
`define FUNC_MULT           6'b011000
`define FUNC_DIV            6'b011010
`define FUNC_DIVU           6'b011011
`define FUNC_JR             6'b001000
`define FUNC_JALR           6'b001001






//ALUOP
//logic & move
`define NOP_OP          8'b00000000
`define OR_OP           8'b00000001
`define AND_OP          8'b00000010
`define NOR_OP          8'b00000011 
`define XOR_OP          8'b00000100
`define MOV_OP          8'b00000101
`define MFHI_OP         8'b00000110
`define MFLO_OP         8'b00000111
`define MTHI_OP         8'b00001000
`define MTLO_OP         8'b00001001
//shift
`define SLL_OP          8'b00001010
`define SRA_OP          8'b00001011
`define SRL_OP          8'b00001100
`define LUI_OP          8'b00001101
//arithmetic
`define ADD_OP          8'b00001110
`define ADDU_OP         8'b00001111
`define SUB_OP          8'b00010000
`define SUBU_OP         8'b00010001
`define SLT_OP          8'b00010010
`define SLTU_OP         8'b00010011
`define MULT_OP         8'b00010100
`define MULTU_OP        8'b00010101
`define DIV_OP          8'b00010110
`define DIVU_OP         8'b00010111
//branch
`define BRANCH_OP       8'b00011000
`define EXE_RES_BRANCH    3'b100
`define EXE_RES_LOGIC       3'b001
`define EXE_RES_NOP         3'b000
`define EXE_RES_SHIFT       3'b010

`define EXE_RES_ARITH       3'b011

`define AddressBus          31:0
`define DataBus             31:0
`define MemoryNum           131071
`define MemoryNumLog2       17

`define RegisterAddressBus  4:0
`define RegisterBus         31:0
`define RegisterWidth       32
`define DoubleRegisterWidth 64
`define DoubleRegisterBus   63:0
`define RegisterNum         32
`define RegisterNumLog2     5
`define NOPRegisterAddress  5'b00000
`define STALL_BUS           5:0 



`define HI 1'b1
`define LO 1'b0

// Div
`define DivFree             2'b00
`define DivByZero           2'b01
`define DivOn               2'b10
`define DivEnd              2'b11
`define DivResultReady      1'b1
`define DivResultNotReady   1'b0
`define DivStart            1'b1
`define DivStop             1'b0